// 医院列表相关的请求
import { request } from "@/utils/http"
import {
  submitPagingList,
  getPagingList,
  Status,
  IdeList,
} from "@api/hospitalList/model"

const api_name = "/admin/hosp/hospital"
// 获取分页
export const addHospitalList = ({ page, pageSize, ...values }: any) => {
  return request.get<any, any>(`${api_name}/${page}/${pageSize}`, {
    params: values,
  })
}

// 修改状态：/admin/hosp/hospital/updateStatus/{id}/{status}
export const modifyState = (id: string, status: any) => {
  return request.get<any, null>(`${api_name}/updateStatus/${id}/${status}`)
}

// 获取医院详情  /admin/hosp/hospital/show/{id}
export const HospitalDetails = (id: string) => {
  return request.get<any, any>(`${api_name}/show/${id}`)
}

// 获取省数据的函数 /admin/cmn/dict/findByDictCode/{dictCode}
export const provincialLevel = (dictCode = "province") => {
  return request.get<any, any>(`/admin/cmn/dict/findByDictCode/${dictCode}`)
}

// 获取市区，根据上一级的id来获取
// /admin/cmn/dict/findByParentId/{parentId}
export const MunicipalLevel = (parentId: string) => {
  return request.get(`/admin/cmn/dict/findByParentId/${parentId}`)
}

// 科室信息
// GET /admin/hosp/department/{hoscode}
export const Department = (hoscode: string) => {
  return request.get<any, IdeList>(`/admin/hosp/department/${hoscode}`)
}

// 医生排班数据 /admin/hosp/schedule/findScheduleList/{hoscode}/{depcode}/{workDate}
export const DoctorScheduling = (
  hoscode: string,
  depcode: string,
  workDate: string
) => {
  return request.get<any, any>(
    `/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`
  )
}
// 排班规则顺序 GET /admin/hosp/schedule/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}
export const SchedulingOrder = (
  page: number,
  pageSize: number,
  hoscode: string,
  depcode: string
) => {
  return request.get<any, any>(
    `/admin/hosp/schedule/getScheduleRule/${page}/${pageSize}/${hoscode}/${depcode}`
  )
}
